package com.ruoyi.web.controller.monitor;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.monitor.domain.BusWaterAutomonitorDaydata;
import com.ruoyi.monitor.domain.BusWaterAutomonitorHourdata;
import com.ruoyi.monitor.domain.GetWaterAutomonitorParam;
import com.ruoyi.monitor.service.IBusWaterAutomonitorDaydataService;
import com.ruoyi.monitor.service.IBusWaterAutomonitorHourdataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.*;

/**
 * @author pc
 * @version 1.0
 * @description: 自动站趋势变化分析
 * @date 2025/9/20 22:41
 */
@RestController
@RequestMapping("/monitor/auto/trendChangeAnalysis")
public class BusWaterAutoMonitorHourTrendChangeAnalysisController extends BaseController {

    @Autowired
    private IBusWaterAutomonitorHourdataService busWaterAutomonitorHourdataService;
    @Autowired
    private IBusWaterAutomonitorDaydataService busWaterAutomonitorDaydataService;

    /**
     * @title : getAutoMonitorHourTrendChangeAnalysis
     * @Description :   自动站趋势变化分析
     * @param  getWaterAutomonitorParam
     * @return : com.ruoyi.common.core.domain.AjaxResult
     * @author pc
     * @date : 2025/9/20 22:58
     */
    @RequestMapping("/getAutoMonitorHourTrendChangeAnalysis")
    public AjaxResult getAutoMonitorHourTrendChangeAnalysis(GetWaterAutomonitorParam getWaterAutomonitorParam) {
        List<Map<String, Object>> mapList = new ArrayList<>();

        if (StringUtils.isNotEmpty(getWaterAutomonitorParam.getDatatype()) && Objects.equals(getWaterAutomonitorParam.getDatatype(), "0")) {
            List<BusWaterAutomonitorHourdata> list = busWaterAutomonitorHourdataService.selectBusWaterAutomonitorHourdataItemList(getWaterAutomonitorParam);
            return AjaxResult.success(list);
        }else if (StringUtils.isNotEmpty(getWaterAutomonitorParam.getDatatype()) && Objects.equals(getWaterAutomonitorParam.getDatatype(), "1")){
            List<BusWaterAutomonitorDaydata> list = busWaterAutomonitorDaydataService.selectBusWaterAutomonitorDaydataItemList(getWaterAutomonitorParam);
            return AjaxResult.success(list);
        }
        return AjaxResult.success(null);
    }


}
